<template>
  <div>
    <t-tabs :default-value="1" @change="changeTab">
      <t-tab-panel :value="1" label="基本设置">
        <siteSet :data="settingsData"></siteSet>
      </t-tab-panel>
     <t-tab-panel :value="2" label="Token设置">
        <tokenConfig/>
      </t-tab-panel>
      <t-tab-panel :value="3" label="自定义设置">
         <constomConfig/>
       </t-tab-panel>
	   <t-tab-panel :value="4" label="文档模板">
	      <docTemplates/>
	    </t-tab-panel>
    </t-tabs>
  </div>

</template>

<script lang="ts">
  export default {
    name: 'SettingsBase',
  };
</script>

<script setup lang="ts">
  import {
    settingModel
  } from '@/api/model/settingsModel';
  import { getSettingsList, saveSettings } from '@/api/settings'
 import siteSet from '../components/siteConfig.vue'
 import tokenConfig from  '../components/tokenConfig.vue'
 import constomConfig from '../components/constomConfig.vue'
  import docTemplates from '../components/docTemplates.vue'
import { onMounted ,ref} from 'vue';

 const settingsData=ref<Array<settingModel>>()
 const fetchData = () => {
   getSettingsList('site').then(ret => {
      settingsData.value=ret
   })
 }
 const changeTab=(value:number)=>{
   if(value==1)
   {
     fetchData()
   }
 }
 onMounted(()=>{
   fetchData()

 })
</script>

<style lang="less" scoped>
  @import url('./index.less');
</style>
